package com.xy.zqb.user.controller;
import com.xy.common.base.controller.BaseController;
import com.xy.common.base.entity.AjaxResult;
import com.xy.common.request.zqb.ZqbUserRequest;
import com.xy.zqb.service.ZqbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/zqb/user/")
public class UserController extends BaseController {
    @Autowired
    private ZqbUserService zqbUserService;
    /**
     * 得到挣钱豹用户列表信息
     * @return
     */
    @RequestMapping("list")
    public AjaxResult GetUserListData(){
        try {
            Map<String,Object> data=new HashMap<>();
            data.put("list",zqbUserService.list());
            return success(data);
        }catch (Exception e){
            return dealException(e);
        }
    }
    /**
     * 新增挣钱豹用户信息
     * @return
     */
    @RequestMapping(value = "add/user",method = RequestMethod.POST)
    public AjaxResult AddUser(@RequestBody ZqbUserRequest add){
        try {
            Map<String,Object> data=new HashMap<>();
            Integer result=zqbUserService.add(add);
            data.put("rows",result);
            return success(data);
        }catch (Exception e){
            return dealException(e);
        }
    }
}
